﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;

namespace katOS
{
    class Driver
    {
        /// <summary>
        /// Main method for the kat Operating System
        /// </summary>
        public static void Main()
        {
            Shell katOS = new Shell();
            Scheduler scheduler = new Scheduler();

            //Creation of threads one for the scheduler and other for the shell
            Thread shellThread = new Thread(new ThreadStart(katOS.Shell_Construct));
            Thread schedulerThread = new Thread(new ThreadStart(scheduler.Run));

            shellThread.Start();
            schedulerThread.Start();

            try
            {
                shellThread.Join();

                //print the statistics

                schedulerThread.Abort();
            }
            catch (ThreadStateException e)
            {
                Console.WriteLine(e.Message);
            }
            catch (ThreadInterruptedException e)
            {
                Console.WriteLine(e.Message);
            }
        }
    }
}
